<?php
require 'FormException.php';
function checkForm($form_data = null){
    if(count($form_data) == 0){
        throw new Exception('参数异常');
    }
    if(empty($form_data['username'])){
        throw new NameException('名称不符合规范');
    }
    if(empty($form_data['password']) || empty($form_data['repassword'])){
        throw new PassException('密码或者重复密码不能为空');
    }
    if($form_data['password'] != $form_data['repassword']){
        throw new PassException('密码和重复密码不一样');
    }
    if(empty($form_data['email'])){
        throw new EmailException('邮箱不能为空');
    }
    return '注册成功';
}